package fzdy.event;

import com.google.common.eventbus.EventBus;
import org.springframework.stereotype.Component;

@Component("eventcenter")
public class EventCenter {
    private EventBus eventBus;

    public EventCenter(){
        eventBus = new EventBus();
    }

    public void registerObserver(Object observer){
        eventBus.register(observer);
    }

    public void unregisterObserver(Object observer){
        eventBus.unregister(observer);
    }

    public void postEvent(Object msg){
        eventBus.post(msg);
    }
}
